<template>
    <rui-page :defines="defines">
        <!-- 查询条件 -->
        <rui-query :label-width="120"
                   ref="orderLeadingMngForm"
                   :query="queryData"
                   :query-rows="searchFormOptions">
        </rui-query>
        <Row>
            <Button @click="refresh()" icon="ios-refresh">刷新</Button>
        </Row>
        <rui-table
            :defineId="'orderLeadingMngDefines'"
            :fixedRight="['action']"
            :showIndex="false"
            :select="false"
            :columns="orderLeadingMngColumns"
            @loadDatas="queryData"
            ref-query="orderLeadingMngForm"
            ref="orderLeadingMngTable"
        >
        </rui-table>
    </rui-page>
</template>

<script>
    import "../../../assets/css/base.css";
    import orderLeadingMngDefines from "../../../api/order-lending-management/orderLeadingMngDefines";
    import {getOrderLeadingInfo} from "../../../api/order-lending-management/orderLeadingMngApi";

    export default {
        created() {
            let homeParams = this.afs.getPageParams(this).params;
            console.log("data:", homeParams)
            let key = homeParams.key;
            if (homeParams.flag == 'home') {
                let queryData = {
                    pageNumber: 1,
                    pageSize: 10,
                    condition: {key: homeParams.key},
                }
                this.queryData(queryData);
            }
        },
        mounted() {
        },
        computed: {
            defines() {
                return [{id: "orderLeadingMngDefines", fields: orderLeadingMngDefines}];
            }
        },
        data() {
            return {
                key: "",
                editModalVisible: false,
                name: 'orderLeadingMng',
                //查询条件所用字段
                searchFormOptions: [
                    {
                        isGroup: false,
                        defineId: "orderLeadingMngDefines",
                        fields: ["applyNo", "custName", 'applyStatus', 'contractStatus', 'gpsStatus', 'startDate'],
                    },
                ],
                //详细列表信息显示所用字段
                orderLeadingMngColumns:
                    ['action', 'applyNo','contractNo', 'custName', 'businessType', 'carNature',
                    'carType','applyReporter','loanReporter', 'applyStatus', 'contractStatus',
                        'gpsStatus','intoFirstDate','lendingFirstDate', 'statDate'],
            }
        },
        methods: {
            //查询方法
            queryData(queryData) {
                getOrderLeadingInfo(queryData).then(res => {
                    if (res.code === '0000') {
                        let {records, total} = res.data;
                        this.$refs.orderLeadingMngTable.updateTableData(records, total);
                    }
                });
            },
            //刷新
            refresh() {
                this.$refs['orderLeadingMngTable'].reloadData();
            },
            //编辑
            editRow(row) {
                this.$Message.success("更多功能敬请期待")
            },
            //删除
            deleteRow(row) {
                this.$Message.success("更多功能敬请期待")
            }
        },
    }
</script>
